package util;

import org.neo4j.driver.AuthTokens;
import org.neo4j.driver.GraphDatabase;
import org.neo4j.driver.Session;

/**
 * @author xym
 * @since 2020/7/15
 */
public class Neo4jSession {
    private static final String URI = "bolt://localhost:7687";
    private static final String USER_NAME = "neo4j";
    private static final String PASSWORD = "123456";

    private static class Neo4jSessionInstance {
        private static final Session SESSION = GraphDatabase.driver(URI, AuthTokens.basic(USER_NAME, PASSWORD)).session();
    }

    /**
     * 获取Neo4j的Session
     */
    public static Session getSession() {
        return Neo4jSessionInstance.SESSION;
    }
}
